package com.crl.utils.color
{
	import com.crl.ui.controls.Component;
	
	import flash.events.Event;
	
	public class HSLPanel extends Component
	{
		private var hs:HSMixer;
		private var l:BrightnessBar;
		
		private var lw:int=30;
		public function HSLPanel()
		{
			super();
		}
		
		override protected function create():void{
			hs=new HSMixer();
			l=new BrightnessBar();
			
			addChild(hs);
			addChild(l);
		}
		
		
		override protected function bind() : void{
			hs.addEventListener(Event.CHANGE,hschangeHandler);
			l.addEventListener(Event.CHANGE,lchangeHandler);
		}
		
		private function hschangeHandler(event:Event):void{
			
		}
		
		private function lchangeHandler(event:Event):void{
			
		}
		
		
		public function set color(value:Number):void{
			var rgb:RGB=ConvertColor.HexToRGB(value);
			
			var hsb:HSB=ConvertColor.RGBToHSB(rgb);
			this.hs.hsb=hsb;
			
			//this.l.b
		}
		
		override public function resize(width:int, height:int) : void{
			super.resize(width,height);
			
			hs.resize(width-(lw+10),height);
			
			l.resize(lw,height);
			
			l.x=width-lw;
		}
	}
}